/* =====================================================
   SPO RESULT PAGE - VIS Rating
   Reuses: rr- tab classes from rating-results.css
           rs- table classes from research.css
   ===================================================== */

/* ===== SPO Table Grid ===== */
.spo-table-head,
.spo-table-row {
    display: grid;
    grid-template-columns: 110px 1fr 160px 160px 1fr 90px;
    gap: 0;
}

.spo-table-head {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 14px 24px;
    background: var(--primary-color);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.spo-table-head span {
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
}

.spo-table-head span:last-child {
    justify-content: center;
}

.spo-table-row {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
    align-items: center;
}

.spo-table-row:last-of-type {
    border-bottom: none;
}

.spo-table-row:hover {
    background: rgba(var(--secondary-rgb), 0.03);
}

/* No data row - single column */
.spo-table-row.spo-no-data {
    display: block;
    text-align: center;
}

.spo-table-row.spo-no-data:hover {
    background: transparent;
}

.spo-cell {
    font-size: 0.88rem;
}

.spo-cell-date {
    color: var(--text-muted);
    font-size: 0.84rem;
}

.spo-cell-org {
    font-weight: 500;
    color: var(--text-dark);
    padding-right: 16px;
    line-height: 1.45;
}

.spo-table-row:hover .spo-cell-org {
    color: var(--secondary-color);
}

.spo-cell-sector {
    color: var(--text-muted);
    font-size: 0.84rem;
}

.spo-cell-type {
    font-size: 0.84rem;
    color: var(--text-body);
}

.spo-cell-standard {
    font-size: 0.84rem;
    color: var(--text-body);
    line-height: 1.5;
}

.spo-cell-report {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.spo-cell-report .rr-lang-link {
    font-size: 0.82rem;
}

.spo-table-row:hover .spo-cell-report .rr-lang-link {
    color: var(--primary-color);
}

/* ===== SPO Table Scroll ===== */
.spo-table-scroll {
    max-height: 600px;
    overflow-y: auto;
}

/* ===== SPO Filter Popover - Pinned to Header ===== */

/* When filter popover is pinned, make header relative for proper positioning */
.spo-table-head.rr-header-relative {
  position: relative !important;
}

/* Wrapper for pinned filter popover - positioned below the header row */
.spo-table-head .spo-filter-wrapper {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 6px;
  z-index: 1000;
}

/* Pinned filter popover for SPO table */
.spo-table-head .spo-filter-popover {
  position: relative !important;
  width: min(320px, calc(100vw - 24px)) !important;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.2);
  display: none;
  overflow: hidden;
}

.spo-table-head .spo-filter-popover.open {
  display: block !important;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .spo-table-head,
    .spo-table-row {
        grid-template-columns: 100px 1fr 140px 140px 1fr 80px;
    }
}

@media (max-width: 768px) {
    .rs-table-wrapper {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        /* Hide scrollbar but keep scroll functionality */
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE/Edge */
    }
    .rs-table-wrapper::-webkit-scrollbar {
        display: none; /* Chrome/Safari */
    }

    /* Set consistent width for all table elements */
    .rr-table-toolbar,
    .spo-table-head,
    .spo-table-scroll,
    .rs-table-footer {
        width: 100%;
        min-width: 1000px; /* 968px (columns) + 32px (padding) */
    }

    .rr-table-toolbar {
        padding: 12px 16px;
        position: sticky;
        left: 0;
        z-index: 10;
        background: #fff;
    }

    .spo-table-head,
    .spo-table-row {
        grid-template-columns: 100px 250px 130px 150px 260px 78px;
        gap: 0;
        padding: 12px 16px;
    }

    .spo-table-head {
        display: grid;
    }

    .spo-cell-org {
        padding-right: 12px;
    }

    .spo-cell,
    .spo-cell-date,
    .spo-cell-sector,
    .spo-cell-type,
    .spo-cell-standard {
        font-size: 0.82rem;
    }

    /* Footer stays fixed - doesn't scroll with table */
    .rs-table-footer {
        position: sticky;
        left: 0;
    }

    /* Filter wrapper on mobile - use fixed positioning */
    .spo-table-head .spo-filter-wrapper {
        position: fixed !important;
        z-index: 9999;
    }
}